package com.itheima;

import com.itheima.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/*
bean的定义相关注解
    类型：类注解
    位置：类定义上方
    注解:
        @Component
        @Controller
        @Service
        @Repository
            四个注解作用完全一致, 定义在类上, 将对象添加到Spring容器中, 等效于XML中:
             <bean id="accountService" class="com.itheima.service.impl.AccountServiceImpl"/>
 */
public class App {
    public static void main(String[] args) {
        //1. 获取核心容器对象
        ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");

        //2. 获取Service
        AccountService service = (AccountService) app.getBean("accountService");
        service.save();
    }
}
